---
title: 'Poland Media Project: Replication Code'
author: "Ashley Blum, Gabriela Czarnek, Adam Berinsky, David Rand"
date: "2026-01-16"
output:
  pdf_document:
    toc: true
    toc_depth: 3
  word_document:
    toc: true
    toc_depth: '3'
  html_document:
    toc: true
    toc_depth: '3'
    df_print: paged
header-includes:
  - \usepackage[T1]{fontenc}
  - \usepackage[utf8]{inputenc}
  - \usepackage[section]{placeins}
---

\clearpage
# Setup
## Load

```{r setup, include=FALSE}
library(haven)
library(dplyr)
library(ggplot2)
library(stringr)
library(sandwich)
library(lmtest)
library(kableExtra)
library(scales)
library(emmeans)
library(ggeffects)
library(lme4)
library(multcomp)
library(multcompView)
library(see)
library(patchwork)
library(estimatr)
library(stargazer)
library(survey)
library(ltm)
library(purrr)


knitr::knit_hooks$set(plot = function(x, options)  {
  paste0(knitr::hook_plot_tex(x, options), "\n\\FloatBarrier\n")
})
```

```{r setup2, include=FALSE}
knitr::opts_chunk$set(
  fig.width = 6.5,
  fig.height = 4,
  out.width = "\\linewidth",
  fig.scap = "",
  dev.args = list(pointsize = 8)
)
```

```{r load, include=FALSE}

load("dat2.RData")

load("dat_long2.RData")

load("dat.RData")

load("dat_long.RData")

dat <- ungroup(dat)
dat2 <- ungroup(dat2)

"%notin%" <- function(x, y) !(x %in% y)

dat_long <- dat_long %>%
  mutate(source_f = recode(source_f, tvn = "TVN", tvp = "TVP"))

dat_long2 <- dat_long2 %>%
  mutate(source_f = recode(source_f, tvr = "TV Republika", tvn = "TVN", tvp = "TVP"))

```


## Article Frequency Weights

```{r weights}
#Pre-Reform Study
weight_dat <- dat_long %>%
  count(source, excerpt, name = "d") %>%          # d = times excerpt appears within source
  group_by(source) %>%
  mutate(
    avg_d = sum(d) / n_distinct(excerpt),         # average appearances per excerpt in source
    excerpt_prev_weight = avg_d / d
  ) %>%
  ungroup() %>%
  dplyr::select(source, excerpt, excerpt_prev_weight)

dat_long <- dat_long %>%
  left_join(weight_dat, by = c("source", "excerpt"))



#Post-Reform Study

weight_dat2 <- dat_long2 %>%
  count(source, excerpt, name = "d") %>%          # d = times excerpt appears within source
  group_by(source) %>%
  mutate(
    avg_d = sum(d) / n_distinct(excerpt),         # average appearances per excerpt in source
    excerpt_prev_weight = avg_d / d
  ) %>%
  ungroup() %>%
  dplyr::select(source, excerpt, excerpt_prev_weight)

dat_long2 <- dat_long2 %>%
  left_join(weight_dat2, by = c("source", "excerpt"))

```


## Combine Data Files

```{r combine_data}
dat_long_all <- data.table::rbindlist(list(dat_long, dat_long2), use.names = TRUE, fill = TRUE, idcol = TRUE)

dat_long_all <- dat_long_all %>%
  rename("study" = .id ) %>%
  mutate(study2 = ifelse(study==2, 1, 0),
         tvp = ifelse(source == "tvp", 1, 0),
         tvn = ifelse(source == "tvn", 1, 0),
         source_f = factor(source_f, levels = c("TV Republika", "TVN", "TVP")),
         study_f_label = case_when(
           study == 1 ~ "Pre-Reform",
           study == 2 ~ "Post-Reform"),
         study_f_label = factor(study_f_label, levels = c("Pre-Reform", "Post-Reform"))
         )

```



\clearpage
%%%%Main Paper


# Introduction (Figure 1): CBOS Analysis

```{r cbos_analysis}
years <- c(2006:2014, 2016:2023)

# --- Load all cbos data files (cbos06, cbos07, ...) ---
for (y in years) {
  load(sprintf("cbos%02d.R", y %% 100), envir = .GlobalEnv)
}
# Put datasets in a named list
cbos <- setNames(
  map(years, ~ get(sprintf("cbos%02d", .x %% 100))),
  as.character(years)
)

# --- Survey designs (svy06, svy07, ...) in a list ---
svy <- map(cbos, ~ svydesign(id = ~1, data = .x, weights = ~weights))

# --- Overall means 
fav_tvp_s_gov_means <- imap_dfr( #loop over survey designs
  svy,
  ~ svymean(~fav_tvp_s, .x, na.rm = TRUE) %>% #compute mean for each year
      as_tibble() %>%
      rename(fav_tvp_s = mean, se = fav_tvp_s) %>%
      mutate(year = as.integer(.y), party_gov = -1)
)

# --- Subsample means by party_gov 
fav_tvp_s_gov_pg <- imap_dfr( #loop over survey designs
  svy,
  ~ svyby(~fav_tvp_s, ~party_gov, .x, svymean, na.rm = TRUE) %>%  #compute mean for each party for each year
      mutate(year = as.integer(.y))
)

# --- Combine + labels
fav_tvp_s_gov <- bind_rows(fav_tvp_s_gov_pg, fav_tvp_s_gov_means) %>%
  mutate(
    group = case_when(
      party_gov == -1 ~ "All",
      party_gov == 0  ~ "In Opposition",
      party_gov == 1  ~ "In Government"
    ),
    group = factor(group)
  )

fav_tvp_s_gov$party_gov <- factor(fav_tvp_s_gov$party_gov)

# --- Plot 
tvp_fav_means_plot <- fav_tvp_s_gov %>%
  ggplot(aes(year, fav_tvp_s, group = group, color = group)) +
  geom_point(aes(size = group), alpha = 1) +
  geom_line(aes(linewidth = group), alpha = 0.60) +
  
  # Greyscale-friendly, original-style colors
  scale_color_manual(
    values = c(
      "All"            = "black",
      "In Opposition"  = "#C34232",  # red (opposition)
      "In Government"  = "#5A9A3F"   # green (government)
    ),
    name = "Party"
  ) +
  
  scale_size_manual(
    values = c("All" = 3, "In Opposition" = 1.5, "In Government" = 1.5),
    name = "Party"
  ) +
  scale_linewidth_manual(
    values = c("All" = 2.5, "In Opposition" = 1, "In Government" = 1),
    name = "Party"
  ) +
  
  labs(
    x = "Year",
    y = "Average favorability of TVP"
  ) +
  coord_cartesian(ylim = c(0, 1)) +
  scale_x_continuous(
    limits = c(2006, 2023),
    breaks = c(2007, 2009, 2011, 2013, 2015,
               2017, 2019, 2021, 2023)
  ) +
  geom_vline(xintercept = 2015, color = "grey40", linetype = "dotted") +
  theme_classic() +
  theme(
    axis.text  = element_text(size = 12),
    axis.title = element_text(size = 14)
  )

tvp_fav_means_plot

```


\clearpage



# Pre-Experiment Survey: Expressed Trust (Table 1)
```{r expressed_trust_calc}
dat <- dat %>%
  mutate(trust_tvn_n2 = rescale(trust_tvn_n),
         trust_tvp_n2 = rescale(trust_tvp_n),
         trust_republika_n2 = rescale(trust_republika_n),
         trust_polsat_n2 = rescale(trust_polsat_n))

dat2 <- dat2 %>%
  mutate(trust_tvn_n2 = rescale(trust_tvn_n),
         trust_tvp_n2 = rescale(trust_tvp_n),
         trust_republika_n2 = rescale(trust_republika_n),
         trust_polsat_n2 = rescale(trust_polsat_n))

dat_long <- dat_long %>%
  mutate(trust_tvn_n2 = rescale(trust_tvn_n),
         trust_tvp_n2 = rescale(trust_tvp_n),
         trust_republika_n2 = rescale(trust_republika_n),
         trust_polsat_n2 = rescale(trust_polsat_n))

dat_long2 <- dat_long2 %>%
  mutate(trust_tvn_n2 = rescale(trust_tvn_n),
         trust_tvp_n2 = rescale(trust_tvp_n),
         trust_republika_n2 = rescale(trust_republika_n),
         trust_polsat_n2 = rescale(trust_polsat_n))

dat_long_all <- dat_long_all %>%
  mutate(trust_tvn_n2 = rescale(trust_tvn_n),
         trust_tvp_n2 = rescale(trust_tvp_n),
         trust_republika_n2 = rescale(trust_republika_n),
         trust_polsat_n2 = rescale(trust_polsat_n))

expressed_trust_dat <- dat %>%
  filter(party_bin %in% c("PiS", "DO")) %>%
  group_by(party_bin) %>%
  summarise(
    tvp_trust = mean(trust_tvp_n2, na.rm = T),
    tvn_trust = mean(trust_tvn_n2, na.rm = T),
    republika_trust = mean(trust_republika_n2, na.rm = T),
    polsat_trust = mean(trust_polsat_n2, na.rm = T),
  )

expressed_trust_dat2 <- dat2 %>%
  filter(party_bin %in% c("PiS", "DO")) %>%
  group_by(party_bin) %>%
  summarise(
    tvp_trust = mean(trust_tvp_n2, na.rm = T),
    tvn_trust = mean(trust_tvn_n2, na.rm = T),
    republika_trust = mean(trust_republika_n2, na.rm = T),
    polsat_trust = mean(trust_polsat_n2, na.rm = T),
  )
```


```{r expressed_trust_print, results='asis'}
colnames(expressed_trust_dat) <- c("Party/Coalition Support", "TVP", "TVN", "Republika", "Polsat")

print(xtable::xtable(expressed_trust_dat, 
               caption = "Pre-Reform",
               label = "tab:exp_trust_dist_s1"), include.rownames=FALSE, caption.placement = "bottom")

colnames(expressed_trust_dat2) <- c("Party/Coalition Support", "TVP", "TVN", "Republika", "Polsat")

print(xtable::xtable(expressed_trust_dat2,
               caption = "Post-Reform Study",
               label = "tab:exp_trust_dist_s2"), include.rownames=FALSE, caption.placement = "bottom")
```

# Main Analysis: Experiment

## Dependent Variable: Chronbach's Alpha + correlations
```{r dv_assess}
trust_index <- dat_long_all %>%
  dplyr::select(objective, trustworthy, truthful)
trust_index1 <- dat_long %>%
  dplyr::select(objective, trustworthy, truthful)

cronbach.alpha(trust_index, CI = T)
cronbach.alpha(trust_index1, CI = T)

cor(trust_index, method = "spearman")
```

## Pre-Reform Study Main Results

### Pre-Reform Study Blind Taste Test
```{r fit_btt_1, cache=TRUE}
#preference for TVP content blind, unweighted, pro-pis
m_btt_p_s1 <- lm(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$pro_pis == 1,])
m_btt_p_s1_cl <- lm_robust(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$pro_pis == 1,],
                clusters = ResponseId)

#preference for TVP content blind, unweighted, anti-pis
m_btt_d_s1 <- lm(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$anti_pis == 1,])
m_btt_d_s1_cl <- lm_robust(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$anti_pis == 1,],
                clusters = ResponseId)

#preference for TVP content blind, weighted by article frequency, pro-pis
m_btt_p_s1_w <- lm(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$pro_pis == 1,],
                weights = excerpt_prev_weight)
m_btt_p_s1_w_cl <- lm_robust(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$pro_pis == 1,],
                weights = excerpt_prev_weight,
                clusters = ResponseId)

#preference for TVP content blind, weighted by article frequency, anti-pis
m_btt_d_s1_w <- lm(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$anti_pis == 1,],
                weights = excerpt_prev_weight)
m_btt_d_s1_w_cl <- lm_robust(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$anti_pis == 1,],
                weights = excerpt_prev_weight,
                clusters = ResponseId)
```



## Pre-Reform Study Source Cue Effects

```{r fit_main_1, message=FALSE}
#fit main models, OLS
#TVP effect on pro-pis respondents
m1_p_tvp_s1 <- lm(trust_index ~ treated + excerpt,
               data = dat_long[dat_long$pro_pis == 1 & 
                                dat_long$source == "tvp",]) 

m1_p_tvp_s1_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long[dat_long$pro_pis == 1 & 
                                           dat_long$source == "tvp",],
                         se_type = "stata",
                         clusters = ResponseId) 


m1_p_tvp_s1_w <- lm(trust_index ~ treated + excerpt,
               data = dat_long[dat_long$pro_pis == 1 & 
                                dat_long$source == "tvp",],
               weights = excerpt_prev_weight) 

m1_p_tvp_s1_w_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long[dat_long$pro_pis == 1 & 
                                           dat_long$source == "tvp",],
                         se_type = "stata",
                         clusters = ResponseId,
                         weights = excerpt_prev_weight) 


#TVN effect on anti-pis/ Democratic Opposition respondents
m1_d_tvn_s1 <- lm(trust_index ~ treated + excerpt,
               data = dat_long[dat_long$anti_pis == 1 & 
                                dat_long$source == "tvn",]) 

m1_d_tvn_s1_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long[dat_long$anti_pis == 1 & 
                                           dat_long$source == "tvn",],
                         se_type = "stata",
                         clusters = ResponseId) 


m1_d_tvn_s1_w <- lm(trust_index ~ treated + excerpt, 
              data = dat_long[dat_long$anti_pis == 1 & 
                                dat_long$source == "tvn",],
              weights = excerpt_prev_weight)
m1_d_tvn_s1_w_cl <- lm_robust(trust_index ~ treated + excerpt,
                           data = dat_long[dat_long$anti_pis == 1 & 
                                           dat_long$source == "tvn",],
                           weights = excerpt_prev_weight,
                           se_type = "stata",
                           clusters = ResponseId) 

#TVN cue effect on pro-pis
m1_p_tvn_s1 <- lm(trust_index ~ treated + excerpt,
               data = dat_long[dat_long$pro_pis == 1 & 
                                dat_long$source == "tvn",]) 

m1_p_tvn_s1_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long[dat_long$pro_pis == 1 & 
                                           dat_long$source == "tvn",],
                         se_type = "stata",
                         clusters = ResponseId) 

m1_p_tvn_s1_w <- lm(trust_index ~ treated + excerpt, 
              data = dat_long[dat_long$pro_pis == 1 & 
                                dat_long$source == "tvn",],
              weights = excerpt_prev_weight)
m1_p_tvn_s1_w_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long[dat_long$pro_pis == 1 & 
                                           dat_long$source == "tvn",],
                         weights = excerpt_prev_weight,
                         se_type = "stata",
                         clusters = ResponseId) 

#tvp effect on anti-pis
m1_d_tvp_s1 <- lm(trust_index ~ treated + excerpt,
               data = dat_long[dat_long$anti_pis == 1 & 
                                dat_long$source == "tvp",]) 

m1_d_tvp_s1_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long[dat_long$anti_pis == 1 & 
                                           dat_long$source == "tvp",],
                         se_type = "stata",
                         clusters = ResponseId) 


m1_d_tvp_s1_w <- lm(trust_index ~ treated + excerpt, 
              data = dat_long[dat_long$anti_pis == 1 & 
                                dat_long$source == "tvp",],
              weights = excerpt_prev_weight)
m1_d_tvp_s1_w_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long[dat_long$anti_pis == 1 & 
                                           dat_long$source == "tvp",],
                         weights = excerpt_prev_weight,
                         se_type = "stata",
                         clusters = ResponseId) 
```


## Pre-Reform Source Cue Effect Size

The counter-source is defined as TVP for Dem. Oppo. supporters and TVN for PiS supporters. Note that in the Fox-CNN study, Cohen's D for the counter source effect was -0.104.

### Counter Source (TVP) Effect for Democratic Opposition supporters 

```{r cohens_do_counter, echo=FALSE}
#Effect Size, Split By Party
##Democratic Opposition: tvp Effect

g0_d_tvp <- na.omit(dat_long$trust_index[dat_long$anti_pis == 1 &
                                           dat_long$source == "tvp" &
                                           dat_long$treated == 0])
g1_d_tvp <- na.omit(dat_long$trust_index[dat_long$anti_pis == 1 &
                                           dat_long$source == "tvp" &
                                           dat_long$treated == 1])

cohensD_d_tvp <- effsize::cohen.d(g1_d_tvp, g0_d_tvp) #calc cohens d with effsize packages
cohensD_d_tvp
```

### Counter Source (TVN) Effect for PiS supporters 

```{r cohens_pis_counter, echo=FALSE}
#Effect Size, Split By Party
##PiS Supporters: TVN effect

g0_p_tvn <- na.omit(dat_long$trust_index[dat_long$pro_pis == 1 &
                                           dat_long$source == "tvn" &
                                           dat_long$treated == 0])
g1_p_tvn <- na.omit(dat_long$trust_index[dat_long$pro_pis == 1 &
                                           dat_long$source == "tvn" &
                                           dat_long$treated == 1])

cohensD_p_tvn <- effsize::cohen.d(g1_p_tvn, g0_p_tvn) #calc cohens d with effsize packages
cohensD_p_tvn
```


### Aligned source effect size

The aligned-source is defined as TVN for Dem. Oppo. supporters and TVP for PiS supporters. Note that in the Fox-CNN study, Cohen's D for the aligned source effect was 0.062. 

### Aligned Source (TVN) Effect for DO supporters 

```{r cohens_do_aligned, echo=FALSE}
##DO: TVN Effect

g0_d_tvn <- na.omit(dat_long$trust_index[dat_long$anti_pis == 1 &
                                           dat_long$source == "tvn" &
                                           dat_long$treated == 0])
g1_d_tvn <- na.omit(dat_long$trust_index[dat_long$anti_pis == 1 &
                                           dat_long$source == "tvn" &
                                           dat_long$treated == 1])

cohensD_d_tvn <- effsize::cohen.d(g1_d_tvn, g0_d_tvn) #calc cohens d with effsize packages
cohensD_d_tvn
```

### Aligned Source (TVP) Effect for PiS supporters 

```{r cohens_pis_aligned, echo=FALSE}
##PiS: tvp Effect

g0_p_tvp <- na.omit(dat_long$trust_index[dat_long$pro_pis == 1 &
                                           dat_long$source == "tvp" &
                                           dat_long$treated == 0])
g1_p_tvp <- na.omit(dat_long$trust_index[dat_long$pro_pis == 1 &
                                           dat_long$source == "tvp" &
                                           dat_long$treated == 1])

cohensD_p_tvp <- effsize::cohen.d(g1_p_tvp, g0_p_tvp) #calc cohens d with effsize packages
cohensD_p_tvp
```


\clearpage 

# Post-Reform Study Main Results

## Post-Reform Study BTT (no source cue)
```{r btt_study2_emmeans}
m_partybin_btt_s2 <- lm_robust(trust_index ~ source_f * party_bin,
                              data = dat_long2[dat_long2$treated == 0,],
                              clusters = ResponseId)
pairs(emmeans(m_partybin_btt_s2, ~ source_f * party_bin, adj = "tukey"), simple = "each")
```


```{r btt_study2_fit}
#preference for TVP and TVR content (vs. TVN) blind, unweighted, pro-pis
m_btt_p_s2 <- lm(trust_index ~ tvp + tvr,
                data = dat_long2[dat_long2$treatment == "blind" &
                                  dat_long2$pro_pis == 1,])
m_btt_p_s2_cl <- lm_robust(trust_index ~ tvp + tvr,
                data = dat_long2[dat_long2$treatment == "blind" &
                                   dat_long2$pro_pis == 1,],
                clusters = ResponseId)

#preference for TVP content blind, unweighted, anti-pis
m_btt_d_s2 <- lm(trust_index ~ tvp + tvr,
                data = dat_long2[dat_long2$treatment == "blind" &
                                   dat_long2$anti_pis == 1,])
m_btt_d_s2_cl <- lm_robust(trust_index ~ tvp + tvr,
                data = dat_long2[dat_long2$treatment == "blind" &
                                   dat_long2$anti_pis == 1,],
                clusters = ResponseId)
```



## Post-Reform Study Source Cue Effects

```{r fit_main_2}
#fit main models
#note: using p for pro-pis and d for Democratic Opposition
 
#TVP effect on pro-pis respondents
m1_p_tvp_s2 <- lm(trust_index ~ treated + excerpt, 
              data = dat_long2[dat_long2$pro_pis == 1 & 
                                dat_long2$source == "tvp",]) 
m1_p_tvp_s2_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long2[dat_long2$pro_pis == 1 & 
                                           dat_long2$source == "tvp",],
                         se_type = "stata",
                         clusters = ResponseId) 

#TVN cue effect on pro-pis
m1_p_tvn_s2 <- lm(trust_index ~ treated + excerpt,
              data = dat_long2[dat_long2$pro_pis == 1 &
                                dat_long2$source == "tvn",])
m1_p_tvn_s2_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long2[dat_long2$pro_pis == 1 & 
                                           dat_long2$source == "tvn",],
                         se_type = "stata",
                         clusters = ResponseId) 


#tvr effect on pro-pis
m1_p_tvr_s2 <- lm(trust_index ~ treated + excerpt,
              data = dat_long2[dat_long2$pro_pis == 1 &
                                dat_long2$source == "tvr",])
m1_p_tvr_s2_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long2[dat_long2$pro_pis == 1 & 
                                           dat_long2$source == "tvr",],
                         se_type = "stata",
                         clusters = ResponseId) 

#tvp effect on anti-pis
m1_d_tvp_s2 <- lm(trust_index ~ treated + excerpt,
              data = dat_long2[dat_long2$anti_pis == 1 &
                                dat_long2$source == "tvp",])
m1_d_tvp_s2_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long2[dat_long2$anti_pis == 1 & 
                                           dat_long2$source == "tvp",],
                         se_type = "stata",
                         clusters = ResponseId) 


#TVN effect on anti-pis/ Democratic Opposition respondents
m1_d_tvn_s2 <- lm(trust_index ~ treated + excerpt,
              data = dat_long2[dat_long2$anti_pis == 1 &
                                dat_long2$source == "tvn",])
m1_d_tvn_s2_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long2[dat_long2$anti_pis == 1 & 
                                           dat_long2$source == "tvn",],
                         se_type = "stata",
                         clusters = ResponseId) 

#tvr effect on anti-pis
m1_d_tvr_s2 <- lm(trust_index ~ treated + excerpt,
              data = dat_long2[dat_long2$anti_pis == 1 &
                                dat_long2$source == "tvr",])
m1_d_tvr_s2_cl <- lm_robust(trust_index ~ treated + excerpt,
                         data = dat_long2[dat_long2$anti_pis == 1 & 
                                           dat_long2$source == "tvr",],
                         se_type = "stata",
                         clusters = ResponseId) 

```



# Pre-Reform Study VS Post-Reform Study Main Results

```{r fit_int_t1v2}
m_t1v2_int_do <- lm(trust_index ~ treated_f*source_f*study_f_label,
                    data = dat_long_all[dat_long_all$anti_pis == 1 & dat_long_all$source %in% c("tvn", "tvp"),])

m_t1v2_int_do_robust <- lm_robust(trust_index ~ treated_f*source_f*study_f_label,
                                  data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                         dat_long_all$source %in% c("tvn", "tvp"),],
                                  clusters = ResponseId)

m_t1v2_int_pis <- lm(trust_index ~ treated_f*source_f*study_f_label, 
                    data = dat_long_all[dat_long_all$pro_pis == 1 & dat_long_all$source %in% c("tvn", "tvp"),])
m_t1v2_int_pis_robust <- lm_robust(trust_index ~ treated_f*source_f*study_f_label,
                                   data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                         dat_long_all$source %in% c("tvn", "tvp"),],
                                   clusters = ResponseId)


m_t1v2_int_do_w <- lm(trust_index ~ treated_f*source_f*study_f_label,
                    data = dat_long_all[dat_long_all$anti_pis == 1 & dat_long_all$source %in% c("tvn", "tvp"),],
                    weights = excerpt_prev_weight
                    )

m_t1v2_int_do_w_robust <- lm_robust(trust_index ~ treated_f*source_f*study_f_label,
                                  data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                         dat_long_all$source %in% c("tvn", "tvp"),],
                                  weights = excerpt_prev_weight,
                                  clusters = ResponseId)

m_t1v2_int_pis_w <- lm(trust_index ~ treated_f*source_f*study_f_label, 
                    data = dat_long_all[dat_long_all$pro_pis == 1 & dat_long_all$source %in% c("tvn", "tvp"),],
                    weights = excerpt_prev_weight)
m_t1v2_int_pis_w_robust <- lm_robust(trust_index ~ treated_f*source_f*study_f_label,
                                   data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                         dat_long_all$source %in% c("tvn", "tvp"),],
                                   weights = excerpt_prev_weight,
                                   clusters = ResponseId)
```

# Effects Plot

```{r effects_plot_dat, fig.width=10, fig.height=3, out.width="\\linewidth"}
ests_p_s1 <- c(m_btt_p_s1_w_cl$coefficients["tvp"], m1_p_tvp_s1_w_cl$coefficients["treated"], m1_p_tvn_s1_w_cl$coefficients["treated"])
conf_low_p_s1 <- c(m_btt_p_s1_w_cl$conf.low["tvp"], m1_p_tvp_s1_w_cl$conf.low["treated"], m1_p_tvn_s1_w_cl$conf.low["treated"])
conf_high_p_s1 <- c(m_btt_p_s1_w_cl$conf.high["tvp"], m1_p_tvp_s1_w_cl$conf.high["treated"], m1_p_tvn_s1_w_cl$conf.high["treated"])

ests_d_s1 <- c(m_btt_d_s1_w_cl$coefficients["tvp"], m1_d_tvp_s1_cl$coefficients["treated"], m1_d_tvn_s1_w_cl$coefficients["treated"])
conf_low_d_s1 <- c(m_btt_d_s1_w_cl$conf.low["tvp"], m1_d_tvp_s1_cl$conf.low["treated"], m1_d_tvn_s1_w_cl$conf.low["treated"])
conf_high_d_s1 <- c(m_btt_d_s1_w_cl$conf.high["tvp"], m1_d_tvp_s1_cl$conf.high["treated"], m1_d_tvn_s1_w_cl$conf.high["treated"])


ests_p_s2 <- c(m_btt_p_s2_cl$coefficients["tvp"], m_btt_p_s2_cl$coefficients["tvr"], m1_p_tvp_s2_cl$coefficients["treated"], m1_p_tvn_s2_cl$coefficients["treated"], m1_p_tvr_s2_cl$coefficients["treated"])
conf_low_p_s2 <- c(m_btt_p_s2_cl$conf.low["tvp"], m_btt_p_s2_cl$conf.low["tvr"], m1_p_tvp_s2_cl$conf.low["treated"], m1_p_tvn_s2_cl$conf.low["treated"], m1_p_tvr_s2_cl$conf.low["treated"])
conf_high_p_s2 <- c(m_btt_p_s2_cl$conf.high["tvp"], m_btt_p_s2_cl$conf.high["tvr"], m1_p_tvp_s2_cl$conf.high["treated"], m1_p_tvn_s2_cl$conf.high["treated"], m1_p_tvr_s2_cl$conf.high["treated"])

ests_d_s2 <- c(m_btt_d_s2_cl$coefficients["tvp"], m_btt_d_s2_cl$coefficients[2], m1_d_tvp_s2_cl$coefficients["treated"], m1_d_tvn_s2_cl$coefficients["treated"], m1_d_tvr_s2_cl$coefficients["treated"])
conf_low_d_s2 <- c(m_btt_d_s2_cl$conf.low["tvp"], m_btt_d_s2_cl$conf.low[2], m1_d_tvp_s2_cl$conf.low["treated"], m1_d_tvn_s2_cl$conf.low["treated"], m1_d_tvr_s2_cl$conf.low["treated"])
conf_high_d_s2 <- c(m_btt_d_s2_cl$conf.high["tvp"], m_btt_d_s2_cl$conf.high[2],m1_d_tvp_s2_cl$conf.high["treated"], m1_d_tvn_s2_cl$conf.high["treated"], m1_d_tvr_s2_cl$conf.high["treated"])


n_mods_s1 <- length(ests_p_s1)
n_mods_s2 <- length(ests_p_s2)
mods_s1 <- rep(c("TVP Concealed Condition Pref\n(vs. TVN)", "TVP Revealed Effect", "TVN Revealed Effect"), 2)
mods_s2 <- rep(c("TVP Concealed Condition Pref\n(vs. TVN)", "TV Republika Concealed Condition Pref\n(vs. TVN)", "TVP Revealed Effect", "TVN Revealed Effect", "TV Republika Revealed Effect"), 2)

ests <- c(ests_p_s1, ests_d_s1, ests_p_s2, ests_d_s2)
conf_low <- c(conf_low_p_s1, conf_low_d_s1, conf_low_p_s2, conf_low_d_s2)
conf_high <- c(conf_high_p_s1, conf_high_d_s1, conf_high_p_s2, conf_high_d_s2)
party <- c(rep("PiS", n_mods_s1), rep("DO", n_mods_s1), rep("PiS", n_mods_s2), rep("DO", n_mods_s2))
mod <- c(mods_s1, mods_s2)
study <- c(rep("Pre-Reform", 2*n_mods_s1), rep("Post-Reform", 2*n_mods_s2))

plot_dat <- data.frame(study, mod, party, ests, conf_low, conf_high)
plot_dat$mod <- factor(plot_dat$mod, levels = rev(c("TVP Concealed Condition Pref\n(vs. TVN)", "TV Republika Concealed Condition Pref\n(vs. TVN)",
                                                    "TVP Revealed Effect", "TVN Revealed Effect", "TV Republika Revealed Effect")))

plot_dat <- plot_dat %>% mutate(group = paste(party, study),
                                group = factor(group, levels = c(
                                  "PiS Post-Reform","PiS Pre-Reform",
                                  "DO Post-Reform", "DO Pre-Reform")))

plot_dat_btt <- plot_dat %>%
  filter(grepl('Pref', mod)) %>%
  mutate(mod = factor(mod, levels = c("TV Republika Concealed Condition Pref\n(vs. TVN)", "TVP Concealed Condition Pref\n(vs. TVN)")))


plot_dat_cue <- plot_dat %>%
  filter(grepl('Effect', mod)) %>%
  mutate(mod = factor(mod, levels = c( "TV Republika Revealed Effect", "TVN Revealed Effect", "TVP Revealed Effect")))



effects_plot_btt <- ggplot(plot_dat_btt, 
                       aes(x = ests, y = mod, group = group,
                           colour = group, shape = group)) +
  geom_vline(xintercept=0, colour="black", linewidth=.7) +  # Line at 0
  geom_point(position = ggstance::position_dodgev(height=0.5), size = 2.5) + 
  geom_errorbarh(aes(xmin=conf_low, xmax=conf_high), height = .2,
                 position = ggstance::position_dodgev(height=0.5), linewidth = 1) +  #Ranges for each coefficient
  labs(y="", x= "Estimate") +  # Labels
  xlim(-.25, .25) +
  scale_shape_manual(values = c(15, 0, 15, 0)) +
  scale_colour_manual(values = c("darkblue", "darkblue","orange", "orange")) +
  theme_bw() +  # Nicer theme
  theme(axis.text = element_text(size = 14)) +
  theme(legend.text = element_text(size = 10)) +
  labs(colour  = "Guide", linetype = "Guide", shape = "Guide") +
  theme(legend.direction='vertical') + 
  guides(color = guide_legend(reverse=TRUE), shape = guide_legend(reverse=TRUE)) 

effects_plot_btt

effects_plot_cue <- ggplot(plot_dat_cue, 
                       aes(x = ests, y = mod, group = group,
                           colour = group, shape = group)) +
  geom_vline(xintercept=0, colour="black", linewidth=.7) +  # Line at 0
  geom_point(position = ggstance::position_dodgev(height=0.5), size = 2.5) + 
  geom_errorbarh(aes(xmin=conf_low, xmax=conf_high), height = .2,
                 position = ggstance::position_dodgev(height=0.5), linewidth = 1) +  #Ranges for each coefficient
  labs(y="", x= "Estimate") +  # Labels
  xlim(-.25, .25) +
  scale_shape_manual(values = c(15, 0, 15, 0)) +
  scale_colour_manual(values = c("darkblue", "darkblue","orange", "orange")) +
  theme_bw() +  # Nicer theme
  theme(axis.text = element_text(size = 14)) +
  theme(legend.text = element_text(size = 10)) +
  labs(colour  = "Guide", linetype = "Guide", shape = "Guide") +
  theme(legend.direction='vertical') + 
  guides(color = guide_legend(reverse=TRUE), shape = guide_legend(reverse=TRUE)) 

effects_plot_cue

ggsave(filename = "effects_plot_btt.png", plot = effects_plot_btt,  device = "png", width = 10, height = 3)
ggsave(filename = "effects_plot_cue.png", plot = effects_plot_cue,  device = "png", width = 10, height = 4)

```

# Estimated Marginal Means Plot


```{r plot_t1v2_paper, fig.width=10, fig.height=10, out.width="\\linewidth"}
m_t1v2_int_do_w_plot <- m_t1v2_int_do_w_robust %>% 
  ggemmeans(terms = c("source_f", "treated_f", "study_f_label")) %>% 
  ggplot(aes(x, predicted, fill = group)) +
  ylim(0,1.7) +
  scale_y_continuous(n.breaks = 7) +
  geom_bar(stat = "identity", position = "dodge") + 
  facet_wrap(~facet) +
  geom_errorbar(aes(ymin = conf.low, ymax = conf.high),
                alpha = 0.50,
                position = position_dodge(width = 0.90), width = 0.50) +
  scale_fill_manual(values = c("#AEB1BF", "#1A4A8F"), labels = c("Concealed Source", "Revealed Source")) +
  labs(title = "Dem. Opposition",
       x = "Source", fill = "Treatment", y = "Trust index") + 
  theme_classic() +
  theme(text = element_text(size = 30),
        axis.title.x = element_blank(),
        axis.text.x = element_text(size = 25),
        axis.ticks.x = element_blank(),
        legend.position = "bottom"
        ) 


m_t1v2_int_pis_w_plot <- m_t1v2_int_pis_w_robust %>% 
  ggemmeans(terms = c("source_f", "treated_f", "study_f_label")) %>% 
  ggplot(aes(x, predicted, fill = group)) +
  ylim(0,1.7) +
  scale_y_continuous(n.breaks = 7) +
  geom_bar(stat = "identity", position = "dodge") + 
  facet_wrap(~facet) +
  geom_errorbar(aes(ymin = conf.low, ymax = conf.high),
                alpha = 0.50,
                position = position_dodge(width = 0.90), width = 0.50) +
  scale_fill_manual(values = c("#AEB1BF", "#1A4A8F"), labels = c("Concealed Source", "Revealed Source")) +
  labs(title = "PiS",
       x = "Source", fill = "Treatment", y = "Trust index") + 
  theme_classic() +
  theme(text = element_text(size = 30),
        axis.title.x = element_blank(),
        axis.text.x = element_text(size = 25),
        axis.ticks.x = element_blank(),
        legend.position = "bottom"
        ) 
  

m_t1v2_int_do_w_plot
m_t1v2_int_pis_w_plot

ggpubr::ggarrange(m_t1v2_int_do_w_plot, m_t1v2_int_pis_w_plot, ncol=1, nrow=2, common.legend = T, legend = "bottom") %>%
  ggpubr::ggexport(filename = "m_t1v2_int_w_plot.png", width = 1600, height = 1600, pointsize = 100)
```

\clearpage

# APPENDIX


# Appendix B: Over Time Analyses
## TVP and TVN Favorability 2014

```{r}
cbos14 <- read_spss("cbos_tvp_time/CBOS_201407_286_SPSS.sav") 

cbos14 <- cbos14 %>%
  zap_labels() %>%
  mutate(party = as.factor(case_when(q33 == 1 ~ "NP_Korwin", 
                                     q33 == 2 ~ "PO",
                                     q33 == 3 ~ "PPP",
                                     q33 == 4 ~ "PR_Gowin", # exclude
                                     q33 == 5 ~ "PSL",
                                     q33 == 6 ~ "PR_Jurek", # exclude?
                                     q33 == 7 ~ "PiS",
                                     q33 == 8 ~ "SLD",
                                     q33 == 9 ~ "SP_Ziobro",
                                     q33 == 10 ~ "TR_Palikot",
                                     (q33 == 11 | q33 == 97 | q33 == 98) ~ "DK/Other/Refusal")),
         party_bin = as.factor(case_when(party == "PiS" | party == "SP_Ziobro" ~ "PiS",
                                       party == "PO" | party == "PSL" | party == "SLD" ~ "PO-PSL-SLD")),
         # create party favoritism vars
         fav_po = case_when(q36s1 <= 7 ~ q36s1, TRUE ~ NA_real_),
         fav_psl = case_when(q36s2 <= 7 ~ q36s2, TRUE ~ NA_real_),
         fav_sld = case_when(q36s5 <= 7 ~ q36s5, TRUE ~ NA_real_),
         fav_pis = case_when(q36s3 <= 7 ~ q36s3, TRUE ~ NA_real_),
         # rescale 0-1
         fav_po_n = scales::rescale(fav_po),
         fav_pis_n = scales::rescale(fav_pis),
         # create pro- vs. against party pref (excludes mid-point)
         fav_po01 = as.factor(case_when(fav_po <= 3 ~ "anti", fav_po == 4 ~ "mid", fav_po >= 5 ~ "pro")), 
         fav_psl01 = as.factor(case_when(fav_psl <= 3 ~ "anti", fav_psl == 4 ~ "mid", fav_psl >= 5 ~ "pro")), 
         fav_sld01 = as.factor(case_when(fav_sld <= 3 ~ "anti", fav_sld == 4 ~ "mid", fav_sld >= 5 ~ "pro")), 
         fav_pis01 = as.factor(case_when(fav_pis <= 3 ~ "anti", fav_pis == 4 ~ "mid", fav_pis >= 5 ~ "pro")),
         
         #media favorability 
         fav_polsat = case_when(q42s5 <= 4 ~ 5 - q42s5, TRUE ~ NA_real_),
         fav_tvp = case_when(q42s6 <= 4 ~ 5 - q42s6, TRUE ~ NA_real_),
         fav_tvn = case_when(q42s7 <= 4 ~ 5 - q42s7, TRUE ~ NA_real_),
         fav_polsat_n = scales::rescale(fav_polsat),
         fav_tvp_n = scales::rescale(fav_tvp),
         fav_tvn_n = scales::rescale(fav_tvn))
```



```{r}
m1_fav_tvp_party_bin <- lm(fav_tvp_n ~ party_bin,
                           data = cbos14)
m2_fav_tvp_party <- lm(fav_tvp_n ~ party,
                       data = cbos14 %>% filter(party %in% c("PO","PiS","PSL","SLD")))

m1_fav_tvn_party_bin <- lm(fav_tvp_n ~ party_bin,
                           data = cbos14)
m2_fav_tvn_party <- lm(fav_tvn_n ~ party,
                       data = cbos14 %>% filter(party %in% c("PO","PiS","PSL","SLD")))

```

```{r}
m1_fav_tvp_plot <- m1_fav_tvp_party_bin %>%
  ggemmeans(terms = "party_bin") %>% 
  ggplot(aes(x, predicted, fill = x)) +
  geom_bar(stat = "identity", position = "dodge") +
  geom_errorbar(aes(ymin = predicted - 1.96 * std.error, 
                    ymax = predicted + 1.96 * std.error), 
                position = "dodge", width = 0.50, color = "grey40") + 
  labs(title = "", #March 2014 favorability of TVP by party", 
       x = "Party", fill = "Party",
       y = "Favorability of TVP") + 
  scale_fill_manual(values = c("#26468B", "#DC4D01")) +
  coord_cartesian(ylim = c(0,1)) + 
  theme_classic() +
  theme(legend.position = "none",
        axis.text=element_text(size=14),
        axis.title=element_text(size=16))
m1_fav_tvp_plot

ggsave("tvp2014_party2.png", m1_fav_tvp_plot, device = png, width = 5, height = 5)
```

```{r}
m2_fav_tvp_plot <- m2_fav_tvp_party %>%
  ggemmeans(terms = "party") %>% 
  ggplot(aes(x, predicted, fill = x)) +
  geom_bar(stat = "identity", position = "dodge") +
  geom_errorbar(aes(ymin = predicted - 1.96 * std.error, 
                    ymax = predicted + 1.96 * std.error), 
                position = "dodge", width = 0.50, color = "grey20") + 
  labs(title = "", #"March 2014 favorability of TVP by party", 
       x = "Party", fill = "Party",
       y = "Favorability of TVP") + 
  scale_fill_manual(values = c("#26468B", "#DC4D01", "darkgreen", "darkred")) +
  coord_cartesian(ylim = c(0,1)) + 
  theme_classic() +
  theme(legend.position = "none",
        axis.text=element_text(size=14),
        axis.title=element_text(size=16))
m2_fav_tvp_plot

ggsave("tvp2014_party4.png", m2_fav_tvp_plot, device = png, width = 5, height = 5)

```

```{r}
m1_fav_tvn_plot <- m1_fav_tvn_party_bin %>%
  ggemmeans(terms = "party_bin") %>% 
  ggplot(aes(x, predicted, fill = x)) +
  geom_bar(stat = "identity", position = "dodge") +
  geom_errorbar(aes(ymin = predicted - 1.96 * std.error, 
                    ymax = predicted + 1.96 * std.error), 
                position = "dodge", width = 0.50, color = "grey40") + 
  labs(title = "", #March 2014 favorability of TVP by party", 
       x = "Party", fill = "Party",
       y = "Favorability of TVP") + 
  scale_fill_manual(values = c("#26468B", "#DC4D01")) +
  coord_cartesian(ylim = c(0,1)) + 
  theme_classic() +
  theme(legend.position = "none",
        axis.text=element_text(size=14),
        axis.title=element_text(size=16))
m1_fav_tvn_plot

ggsave("tvn2014_party2.png", m1_fav_tvn_plot, device = png, width = 5, height = 5)
```

```{r}
m2_fav_tvn_plot <- m2_fav_tvn_party %>%
  ggemmeans(terms = "party") %>% 
  ggplot(aes(x, predicted, fill = x)) +
  geom_bar(stat = "identity", position = "dodge") +
  geom_errorbar(aes(ymin = predicted - 1.96 * std.error, 
                    ymax = predicted + 1.96 * std.error), 
                position = "dodge", width = 0.50, color = "grey20") + 
  labs(title = "", #"March 2014 favorability of TVP by party", 
       x = "Party", fill = "Party",
       y = "Favorability of TVP") + 
  scale_fill_manual(values = c("#26468B", "#DC4D01", "darkgreen", "darkred")) +
  coord_cartesian(ylim = c(0,1)) + 
  theme_classic() +
  theme(legend.position = "none",
        axis.text=element_text(size=14),
        axis.title=element_text(size=16))
m2_fav_tvn_plot

ggsave("tvn2014_party4.png", m2_fav_tvn_plot, device = png, width = 5, height = 5)

```


```{r, results='asis'}
m1 <- m1_fav_tvp_party_bin
m2 <- m1_fav_tvn_party_bin
m3 <- m2_fav_tvp_party
m4 <- m2_fav_tvn_party


stargazer(m1, m2, m3, m4,
          header = FALSE,
          label = "tab:cbos14_1", 
          title = "Source Cues and Political Interest, Pre-Reform Study",
          dep.var.labels = c("TVP Favorability", "TVN Favorability", "TVP Favorability", "TVN Favorability"),
                     column.labels = c("TVP", "TVN", "TVP", "TVN"),
                     covariate.labels = c("Future DO parties", "PO", "PSL", "SLD"),
                     omit.stat = c("f", "rsq", "ser"))
```



# Appendix C: Full Results

## Pre-Reform Content Preferences (Blind Taste Test)

```{r print_btt_1, results='asis', echo=FALSE}
m1 <- m_btt_p_s1
m2 <- m_btt_d_s1
m3 <- m_btt_p_s1_w
m4 <- m_btt_d_s1_w

m1_cl <- m_btt_p_s1_cl
m2_cl <- m_btt_d_s1_cl
m3_cl <- m_btt_p_s1_w_cl
m4_cl <- m_btt_d_s1_w_cl

additional_lines <- list(c("Weights", "No", "No", "Yes", "Yes"))
stargazer::stargazer(m1, m2, m3, m4,
                     header = FALSE,
                     label = "tab:btt_weighted", 
                     title = "Blind Source Preferences in Pre-Reform Study",
                     covariate.labels = c("TVP"),
                     dep.var.labels = c("Trust Index"),
                     column.labels = c( "PiS Respondent", "Dem. Oppo. Respondent", "PiS Respondent", "Dem. Oppo. Respondent"),
                     se=starprep(m1_cl, m2_cl, m3_cl, m4_cl, clusters = dat_long$ResponseId), 
                     omit.stat = c("f", "rsq", "ser"),
                     add.lines = additional_lines,
                     notes = "Trust index measured on 0 (low trust) to 1 (high trust). Reference category is TVN.")
```

## Post-Reform Content Preferences (Bline Taste Test)

```{r print_btt_2, results='asis', echo=FALSE}
m1 <- m_btt_p_s2
m2 <- m_btt_d_s2

m1_cl <- m_btt_p_s2_cl
m2_cl <- m_btt_d_s2_cl


additional_lines <- list(c("Weights", "No", "No"))
stargazer::stargazer(m1, m2,
                     header = FALSE,
                     label = "tab:btt_s2", 
                     title = "Blind Source Preferences in Post-Reform Study",
                     covariate.labels = c("TVP", "TV Republika"),
                     dep.var.labels = c("Trust Index"),
                     column.labels = c("PiS Respondent", "Dem. Oppo. Respondent"),
                     se=starprep(m1_cl, m2_cl, clusters = dat_long$ResponseId), 
                     omit.stat = c("f", "rsq", "ser"),
                     add.lines = additional_lines,
                     notes = "Trust index measured on 0 (low trust) to 1 (high trust). Reference category is TVN.")
```

\clearpage

## Pre-Reform Source Cue Effects


```{r print_main1_results_all, results='asis', message=FALSE, echo=FALSE}
m1 <- m1_p_tvp_s1
m2 <- m1_p_tvn_s1
m3 <- m1_p_tvp_s1_w
m4 <- m1_p_tvn_s1_w
m5 <- m1_d_tvp_s1
m6 <- m1_d_tvn_s1
m7 <- m1_d_tvp_s1_w
m8 <- m1_d_tvn_s1_w


m1_cl <- m1_p_tvp_s1_cl
m2_cl <- m1_p_tvn_s1_cl
m3_cl <- m1_p_tvp_s1_w_cl
m4_cl <- m1_p_tvn_s1_w_cl
m5_cl <- m1_d_tvp_s1_cl
m6_cl <- m1_d_tvn_s1_cl
m7_cl <- m1_d_tvp_s1_w_cl
m8_cl <- m1_d_tvn_s1_w_cl


  
additional_lines <- list(c("Excerpt FE", rep("Yes", 4)), c("Weights", rep("No", 2), rep("Yes", 2)))

stargazer(m1, m2, m3, m4, m5, m6, m7, m8,
          header = FALSE,
          label = "tab:main1_all", 
          title = "Pre-Reform Study Source Cue Effects",
          covariate.labels = c("SourceRevealed"),
          dep.var.labels = c("Trust Index"),
          column.labels = c("TVP|PiS", "TVN|PiS",  "TVP|PiS", "TVN|PiS", "TVP|DO", "TVN|DO",  "TVP|DO", "TVN|DO"),
          se=starprep(m1_cl, m2_cl, m3_cl, m4_cl, m5_cl, m6_cl, m7_cl, m8_cl), 
          omit.stat = c("f", "rsq", "ser"),
          omit = c("excerpt", "Constant"),
          add.lines = additional_lines,
          notes = "Trust index measured on 0 (low trust) to 1 (high trust)")
```


## Post-Reform Source Cue Effects

```{r print_main2_results, results='asis', message=FALSE, echo=FALSE}
m1 <- m1_p_tvp_s2
m2 <- m1_p_tvn_s2
m3 <- m1_p_tvr_s2
m4 <- m1_d_tvp_s2
m5 <- m1_d_tvn_s2
m6 <- m1_d_tvr_s2


m1_cl <- m1_p_tvp_s2_cl
m2_cl <- m1_p_tvn_s2_cl
m3_cl <- m1_p_tvr_s2_cl
m4_cl <- m1_d_tvp_s2_cl
m5_cl <- m1_d_tvn_s2_cl
m6_cl <- m1_d_tvr_s2_cl

  
additional_lines <- list(c("Excerpt FE", rep("Yes", 6)), c("Weights", rep("No", 6)))

stargazer(m1, m2, m3, m4, m5, m6,
          header = FALSE,
          label = "tab:main2",
          title = "Post-Reform Study Source Cue Effects, PiS and Dem. Opposition Respondents",
          covariate.labels = c("SourceRevealed"),
          dep.var.labels = c("Trust Index"),
          column.labels = c("TVP|PiS", "TVN|PiS", "Republika|PiS", "TVP|DO", "TVN|DO", "Republika|DO"),
          se=starprep(m1_cl, m2_cl, m3_cl, m4_cl, m5_cl, m6_cl),
          omit.stat = c("f", "rsq", "ser"),
          omit = c("excerpt", "Constant"),
          add.lines = additional_lines, 
          notes = "Trust index measured on 0 (low trust) to 1 (high trust)")
```

\clearpage

## Pre-Reform vs Post-Reform Experiments

```{r}
m_d_btt_t1v2_w <- lm(trust_index ~ tvp * study_f_label,
                            data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                  dat_long_all$treated == 0,])

m_d_btt_t1v2_w_cl <- lm_robust(trust_index ~ source_f * study_f_label,
                            data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                  dat_long_all$treated == 0 &
                                                  dat_long_all$source_f %in% c("TVP", "TVN"),],
                            clusters = ResponseId)


m_p_btt_t1v2_w <- lm(trust_index ~ tvp * study_f_label,
                              data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                    dat_long_all$treated == 0,],
                              weights = excerpt_prev_weight)
m_p_btt_t1v2_w_cl <- lm_robust(trust_index ~ tvp * study_f_label,
                            data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                  dat_long_all$treated == 0,],
                            clusters = ResponseId)


m_d_tvp_t1v2_w <- lm(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                 dat_long_all$source_f == "TVP",],
                              weights = excerpt_prev_weight)
m_d_tvp_t1v2_w_cl <- lm_robust(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                 dat_long_all$source_f == "TVP",],
                              weights = excerpt_prev_weight,
                              se_type = "stata",
                              clusters = ResponseId) 

m_p_tvp_t1v2_w <- lm(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                    dat_long_all$source_f == "TVP",],
                              weights = excerpt_prev_weight) 
m_p_tvp_t1v2_w_cl <- lm_robust(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                    dat_long_all$source_f == "TVP",],
                              weights = excerpt_prev_weight,
                              se_type = "stata",
                              clusters = ResponseId) 

m_d_tvn_t1v2_w <- lm(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                    dat_long_all$source_f == "TVN",],
                              weights = excerpt_prev_weight) 
m_d_tvn_t1v2_w_cl <- lm_robust(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                    dat_long_all$source_f == "TVN",],
                              weights = excerpt_prev_weight,
                              se_type = "stata",
                              clusters = ResponseId) 


m_p_tvn_t1v2_w <- lm(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                    dat_long_all$source_f == "TVN",],
                              weights = excerpt_prev_weight) 
m_p_tvn_t1v2_w_cl <- lm_robust(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                    dat_long_all$source_f == "TVN",],
                              weights = excerpt_prev_weight,
                              se_type = "stata",
                              clusters = ResponseId) 
```

```{r print_t1v2_results, results='asis', message=FALSE, echo=FALSE}
m1 <- m_p_tvp_t1v2_w
m2 <- m_p_tvn_t1v2_w
m3 <- m_d_tvp_t1v2_w
m4 <- m_d_tvn_t1v2_w

m1_cl <- m_p_tvp_t1v2_w_cl
m2_cl <- m_p_tvn_t1v2_w_cl
m3_cl <- m_d_tvp_t1v2_w_cl
m4_cl <- m_d_tvn_t1v2_w_cl
  
additional_lines <- list(c("Weights", rep("Yes", 4)))

stargazer(m1, m2, m3, m4,
          header = FALSE,
          label = "tab:t1v2",
          title = "Source Cue Effects and Study",
          covariate.labels = c("SourceRevealed", "Post-Reform Study", "SourceRevealed*Post-Reform Study"),
          dep.var.labels = c("Trust Index"),
          column.labels = c("TVP|PiS", "TVN|PiS", "TVP|DO", "TVN|DO"),
          se=starprep(m1_cl, m2_cl, m3_cl, m4_cl),
          omit.stat = c("f", "rsq", "ser"),
          omit = c("excerpt", "Constant"),
          add.lines = additional_lines, 
          notes = "Trust index measured on 0 (low trust) to 1 (high trust)")
```


```{r print_t1v2, results='asis', echo=FALSE, warning=FALSE, message=FALSE}
m1 <- m_t1v2_int_pis
m2 <- m_t1v2_int_do
m3 <- m_t1v2_int_pis_w
m4 <- m_t1v2_int_do_w


m1_cl <- m_t1v2_int_pis_robust
m2_cl <- m_t1v2_int_do_robust
m3_cl <- m_t1v2_int_pis_w_robust
m4_cl <- m_t1v2_int_do_w_robust


additional_lines <- list(c("Weights", rep("No", 2), rep("Yes", 2)))

stargazer(m1, m2, m3, m4,
          header = FALSE,
          label = "tab:t1v2_interact", 
          title = "Changes in Content Preference and Source Cue Effects Between Studies",
          covariate.labels = c("Revealed", "TVP", "Post-Reform Study", "Revealed*TVP", "Revealed*Post-Reform Study", "TVP*Post-Reform Study", "Revealed*TVP*Post-Reform Study"),
          dep.var.labels = c("Trust Index"),
          column.labels = c("PiS Respondent", "DO Respondent", "PiS Respondent", "DO Respondent"),
          se = starprep(m1_cl, m2_cl, m3_cl, m4_cl, clusters = dat_long$ResponseId),
          add.lines = additional_lines,
          omit.stat = c("f", "rsq", "ser"),
          notes = c("Trust index measured on 0 (low trust) to 1 (high trust)."))
```



```{r t1v2_emm}
t1v2_p_emm <- emmeans(m_t1v2_int_pis_w_robust, specs = c("source_f", "treated_f" , "study_f_label"))
t1v2_d_emm <- emmeans(m_t1v2_int_do_w_robust, specs = c("source_f", "treated_f" , "study_f_label"))



m_p_tvp_t1v2_emm <- emmeans(m_p_tvp_t1v2_w_cl, ~ treated * study_f_label)

#Contrast
pairs(m_p_tvp_t1v2_emm, by = "study_f_label", reverse = T)

# Define and calculate the specific contrast
t1v2_p_tvp_effect <- contrast(m_p_tvp_t1v2_emm, method = list(
  "Study1_vs_Study2_treatment_effect" = c(-1, 1, 1, -1)
))

# Summarize the results
summary(t1v2_p_tvp_effect)



```

\clearpage

# Appendix D: Moderation by Interest and Knowledge

## Political Interest

```{r}
m_polint_w_robust_s1 <- lm_robust(trust_index ~ pol_int3 * source_f * treated_f * party_bin,
                                data = dat_long, clusters = ResponseId, weights = excerpt_prev_weight)

m_polint_w_robust_s2 <- lm_robust(trust_index ~ pol_int3 * source_f * treated_f * party_bin,
                                data = dat_long2, clusters = ResponseId, weights = excerpt_prev_weight)
```


```{r m2_polint_all_emm}
#Pre-Reform Study
m_polint_w_robust_s1_emm <- cld(emtrends(
  m_polint_w_robust_s1, ~ source_f:treated_f|party_bin, var = "pol_int3"), 
  details = TRUE) 

print(m_polint_w_robust_s1_emm) # compares slopes of pol_int3 


#Post-Reform Study
m_polint_w_robust_s2_emm <- cld(emtrends(
  m_polint_w_robust_s2, ~ source_f:treated_f|party_bin, var = "pol_int3"), 
  details = TRUE) 

print(m_polint_w_robust_s2_emm) # compares slopes of pol_int3 between parties for weighted model
```


```{r m2_polint_all_plot, fig.height=16, fig.width=16, warning=FALSE, echo=FALSE}
m_polint_w_robust_s1_blind_plot_v2 <- m_polint_w_robust_s1 %>% 
  ggemmeans(terms = c("pol_int3", "source_f", "party_bin", "treated_f[Blind]")) %>% 
  plot() + 
  scale_color_manual(values = c("deepskyblue2", "red")) + 
  scale_fill_manual(values = c("deepskyblue2", "red")) +
  labs(title = "Pre-Reform Study, Blind",
       x = "Political interest", y = "Trust index",
       color = "Source") + 
  coord_cartesian(ylim = c(0.35, 0.75)) +
  theme_classic() + theme(legend.position = "bottom")

m_polint_w_robust_s1_rev_plot_v2 <- m_polint_w_robust_s1 %>% 
  ggemmeans(terms = c("pol_int3", "source_f", "party_bin", "treated_f[Revealed]")) %>% 
  plot() + 
  scale_color_manual(values = c("deepskyblue2", "red")) + 
  scale_fill_manual(values = c("deepskyblue2", "red")) +
  labs(title = "Pre-Reform Study, Revealed", 
       x = "Political interest", y = "Trust index", 
       color = "Source") + 
  coord_cartesian(ylim = c(0.35, 0.75)) +
  theme_classic() + theme(legend.position = "none")

m_polint_w_robust_s2_blind_plot_v2 <- m_polint_w_robust_s2 %>% 
  ggemmeans(terms = c("pol_int3", "source_f", "party_bin", "treated_f[Blind]")) %>% 
  plot() + 
  scale_color_manual(values = c("deepskyblue2","darkblue",  "red")) + 
  scale_fill_manual(values = c("deepskyblue2","darkblue", "red")) +
  labs(title = "Post-Reform Study, Blind", 
                x = "Political interest", y = "Trust index", 
                color = "Source") + 
  coord_cartesian(ylim = c(0.35, 0.75)) +
  theme_classic() + theme(legend.position = "bottom")

m_polint_w_robust_s2_rev_plot_v2 <- m_polint_w_robust_s2 %>% 
  ggemmeans(terms = c("pol_int3", "source_f", "party_bin", "treated_f[Revealed]")) %>% 
  plot() + 
  scale_color_manual(values = c( "deepskyblue2", "darkblue", "red")) + 
  scale_fill_manual(values = c( "deepskyblue2", "darkblue", "red")) +
  labs(title = "Post-Reform Study, Revealed", 
       x = "Political interest", y = "Trust index", 
       color = "Source") + 
  coord_cartesian(ylim = c(0.35, 0.75)) +
  theme_classic() + theme(legend.position = "bottom")

legend_grob <- ggpubr::get_legend(m_polint_w_robust_s2_rev_plot_v2)

int_out_v2 <- ggpubr::ggarrange(m_polint_w_robust_s1_blind_plot_v2, m_polint_w_robust_s1_rev_plot_v2, m_polint_w_robust_s2_blind_plot_v2, m_polint_w_robust_s2_rev_plot_v2, ncol = 2, nrow = 2,
                  top = "Pre-Reform Study Source Cue Effects and Political Interest", 
                  common.legend = FALSE, legend="bottom", legend.grob = legend_grob)

int_out_v2[1]

ggpubr::ggexport(int_out_v2[1],filename = "polint_plot_v2.png", width = 1600, height = 1600, pointsize = 100, res = 200)
```



```{r fit_polint_source_cue}

#Fit political interest models
#Pre-reform

m_polint_tvp_p_s1_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long[dat_long$party_bin == "PiS" & dat_long$source_f == "TVP",],
                                weights = excerpt_prev_weight)

m_polint_tvp_p_s1_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long[dat_long$party_bin == "PiS" & dat_long$source_f == "TVP",],
                                weights = excerpt_prev_weight, clusters = ResponseId)

m_polint_tvp_d_s1_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long[dat_long$party_bin == "DO" & dat_long$source_f == "TVP",],
                                weights = excerpt_prev_weight)

m_polint_tvp_d_s1_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long[dat_long$party_bin == "DO" & dat_long$source_f == "TVP",],
                                weights = excerpt_prev_weight, clusters = ResponseId)

m_polint_tvn_p_s1_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long[dat_long$party_bin == "PiS" & dat_long$source_f == "TVN",],
                                weights = excerpt_prev_weight)

m_polint_tvn_p_s1_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long[dat_long$party_bin == "PiS" & dat_long$source_f == "TVN",],
                                weights = excerpt_prev_weight, clusters = ResponseId)

m_polint_tvn_d_s1_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long[dat_long$party_bin == "DO" & dat_long$source_f == "TVN",],
                                weights = excerpt_prev_weight)

m_polint_tvn_d_s1_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long[dat_long$party_bin == "DO" & dat_long$source_f == "TVN",],
                                weights = excerpt_prev_weight, 
                                clusters = ResponseId)

#post reform

m_polint_tvp_p_s2_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                         #weights = excerpt_prev_weight,
                         data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TVP",])

m_polint_tvp_p_s2_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TVP",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)

m_polint_tvp_d_s2_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                         #weights = excerpt_prev_weight,
                         data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TVP",] )

m_polint_tvp_d_s2_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TVP",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)

m_polint_tvn_p_s2_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                                #weights = excerpt_prev_weight,
                                data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TVN",],)

m_polint_tvn_p_s2_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TVN",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)

m_polint_tvn_d_s2_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                                #weights = excerpt_prev_weight,
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TVN",])

m_polint_tvn_d_s2_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                #weights = excerpt_prev_weight
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TVN",],
                                clusters = ResponseId)

m_polint_tvr_p_s2_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                         #weights = excerpt_prev_weight,
                         data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TV Republika",])

m_polint_tvr_p_s2_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TV Republika",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)

m_polint_tvr_d_s2_w<- lm(trust_index ~ pol_int3 * treated_f + excerpt,
                                #weights = excerpt_prev_weight,
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TV Republika",])

m_polint_tvr_d_s2_w_cl <- lm_robust(trust_index ~ pol_int3 * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TV Republika",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)

```


```{r print_polint_cue_s1, results='asis', echo=FALSE, warning=FALSE, message=FALSE}
m1 <- m_polint_tvp_p_s1_w
m2 <- m_polint_tvn_p_s1_w
m3 <- m_polint_tvp_d_s1_w
m4 <- m_polint_tvn_d_s1_w

m1_cl <- m_polint_tvp_p_s1_w_cl
m2_cl <- m_polint_tvn_p_s1_w_cl
m3_cl <- m_polint_tvp_d_s1_w_cl
m4_cl <- m_polint_tvn_d_s1_w_cl

additional_lines <- list(c("Excerpt FE", rep("Yes", 4)), c("Weights", rep("Yes", 4)))


stargazer(m1, m2, m3, m4,
          header = FALSE,
          label = "tab:polint_cue_s1",
          title = "Source Cues and Political Interest, Pre-Reform Study",
          dep.var.labels = c("Trust Index"),
          column.labels = c("TVP|P", "TVN|P", "TVP|D", "TVN|D"),
          se = starprep(m1_cl, m2_cl, m3_cl, m4_cl, clusters = dat_long$ResponseId),
          covariate.labels = c("Political Interest", "Revealed", "Political Interest*Revealed"),
          omit.stat = c("f", "rsq", "ser"),
          omit = "excerpt",
          add.lines = additional_lines,
          notes = c("Trust index measured on 0 (low trust) to 1 (high trust).", "Political interest is 3-pt measure, ranging from 0 to 1."))
```

```{r print_polint_cue_s2, results='asis', echo=FALSE, warning=FALSE, message=FALSE}
m1 <- m_polint_tvp_p_s2_w
m2 <- m_polint_tvn_p_s2_w
m3 <- m_polint_tvr_p_s2_w
m4 <- m_polint_tvp_d_s2_w
m5 <- m_polint_tvn_d_s2_w
m6 <- m_polint_tvr_d_s2_w

m1_cl <- m_polint_tvp_p_s2_w_cl
m2_cl <- m_polint_tvn_p_s2_w_cl
m3_cl <- m_polint_tvr_p_s2_w_cl
m4_cl <- m_polint_tvp_d_s2_w_cl
m5_cl <- m_polint_tvn_d_s2_w_cl
m6_cl <- m_polint_tvr_d_s2_w_cl

additional_lines <- list(c("Excerpt FE", rep("Yes", 6)), c("Weights", rep("No", 6)))


stargazer(m1, m2, m3, m4, m5, m6,
          header = FALSE,
          label = "tab:polint_cue_s2", 
          title = "Source Cues and Political Interest, Post-Reform Study",
          dep.var.labels = c("Trust Index"),
          column.labels = c("TVP|P", "TVN|P", "Republika|P", "TVP|D", "TVN|D", "Republika|D"),
          se = starprep(m1_cl, m2_cl, m3_cl, m4_cl, m5_cl, m6_cl, clusters = dat_long$ResponseId),
          covariate.labels = c("Political Interest", "Revealed", "Political Interest*Revealed"),
          omit.stat = c("f", "rsq", "ser"),
          omit = "excerpt",
          add.lines = additional_lines,
          notes = c("Trust index measured on 0 (low trust) to 1 (high trust).", "Political interest is 3-pt measure, ranging from 0 to 1."))
```


```{r fit_know_all}
m_know_robust_s2 <- lm_robust(trust_index ~ knowledge * source_f * treated_f * party_bin,
                                data = dat_long2, clusters = ResponseId)
```

```{r know_emm}
m_know_robust_s2_emm <- cld(emtrends(
  m_know_robust_s2, ~ source_f:treated_f|party_bin, var = "knowledge"), 
  details = TRUE) 

print(m_know_robust_s2_emm) # compares slopes of pol_int3 between parties for weighted model
```


```{r fit_knowledge_source_cue}

m_knowledge_tvp_p_s2_w<- lm(trust_index ~ knowledge * treated_f + excerpt,
                         #weights = excerpt_prev_weight,
                         data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TVP",])

m_knowledge_tvp_p_s2_w_cl <- lm_robust(trust_index ~ knowledge * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TVP",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)

m_knowledge_tvp_d_s2_w<- lm(trust_index ~ knowledge * treated_f + excerpt,
                         #weights = excerpt_prev_weight,
                         data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TVP",] )

m_knowledge_tvp_d_s2_w_cl <- lm_robust(trust_index ~ knowledge * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TVP",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)

m_knowledge_tvn_p_s2_w<- lm(trust_index ~ knowledge * treated_f + excerpt,
                                #weights = excerpt_prev_weight,
                                data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TVN",],)

m_knowledge_tvn_p_s2_w_cl <- lm_robust(trust_index ~ knowledge * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TVN",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)

m_knowledge_tvn_d_s2_w<- lm(trust_index ~ knowledge * treated_f + excerpt,
                                #weights = excerpt_prev_weight,
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TVN",])

m_knowledge_tvn_d_s2_w_cl <- lm_robust(trust_index ~ knowledge * treated_f + excerpt,
                                #weights = excerpt_prev_weight
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TVN",],
                                clusters = ResponseId)

m_knowledge_tvr_p_s2_w<- lm(trust_index ~ knowledge * treated_f + excerpt,
                         #weights = excerpt_prev_weight,
                         data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TV Republika",])

m_knowledge_tvr_p_s2_w_cl <- lm_robust(trust_index ~ knowledge * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "PiS" & dat_long2$source_f == "TV Republika",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)

m_knowledge_tvr_d_s2_w<- lm(trust_index ~ knowledge * treated_f + excerpt,
                                #weights = excerpt_prev_weight,
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TV Republika",])

m_knowledge_tvr_d_s2_w_cl <- lm_robust(trust_index ~ knowledge * treated_f + excerpt,
                                data = dat_long2[dat_long2$party_bin == "DO" & dat_long2$source_f == "TV Republika",],
                                #weights = excerpt_prev_weight, 
                                clusters = ResponseId)


```


```{r print_knowledge_cue_s2, results='asis', echo=FALSE, warning=FALSE, message=FALSE}
m1 <- m_knowledge_tvp_p_s2_w
m2 <- m_knowledge_tvn_p_s2_w
m3 <- m_knowledge_tvr_p_s2_w
m4 <- m_knowledge_tvp_d_s2_w
m5 <- m_knowledge_tvn_d_s2_w
m6 <- m_knowledge_tvr_d_s2_w

m1_cl <- m_knowledge_tvp_p_s2_w_cl
m2_cl <- m_knowledge_tvn_p_s2_w_cl
m3_cl <- m_knowledge_tvr_p_s2_w_cl
m4_cl <- m_knowledge_tvp_d_s2_w_cl
m5_cl <- m_knowledge_tvn_d_s2_w_cl
m6_cl <- m_knowledge_tvr_d_s2_w_cl

additional_lines <- list(c("Excerpt FE", rep("Yes", 6)), c("Weights", rep("No", 6)))


stargazer(m1, m2, m3, m4, m5, m6,
          header = FALSE,
          label = "tab:knowledge_cue_s2", 
          title = "Source Cues and Political Knowledge, Post-Reform Study",
          dep.var.labels = c("Trust Index"),
          column.labels = c("TVP|P", "TVN|P", "Republika|P", "TVP|D", "TVN|D", "Republika|D"),
          se = starprep(m1_cl, m2_cl, m3_cl, m4_cl, m5_cl, m6_cl, clusters = dat_long$ResponseId),
          covariate.labels = c("Political Knowledge", "Revealed", "Political Knowledge*Revealed"),
          omit.stat = c("f", "rsq", "ser"),
          omit = "excerpt",
          add.lines = additional_lines,
          notes = c("Trust index measured on 0 (low trust) to 1 (high trust).", "Political interest is 3-pt measure, ranging from 0 to 1."))
```

```{r fig.width=16, fig.height=8, out.width="\\linewidth"}
m_know_w_robust_s2_blind_plot_v2 <- m_know_robust_s2 %>% 
  ggemmeans(terms = c("knowledge", "source_f", "party_bin", "treated_f[Blind]")) %>% 
  plot() + 
  scale_color_manual(values = c( "deepskyblue2", "darkblue", "red")) + 
  scale_fill_manual(values = c( "deepskyblue2", "darkblue", "red")) +
  labs(title = "Post-Reform Study, Blind", 
       x = "Political knowledge", y = "Trust index", 
       color = "Source") + 
  coord_cartesian(ylim = c(0.35, 0.75)) +
  theme_classic() + theme(legend.position = "bottom")


m_know_w_robust_s2_rev_plot_v2 <- m_know_robust_s2 %>% 
  ggemmeans(terms = c("knowledge", "source_f", "party_bin", "treated_f[Revealed]")) %>% 
  plot() + 
  scale_color_manual(values = c( "deepskyblue2","darkblue", "red")) + 
  scale_fill_manual(values = c( "deepskyblue2", "darkblue", "red")) +
  labs(title = "Post-Reform Study, Revealed", 
       x = "Political knowledge", y = "Trust index", 
       color = "Source") + 
  coord_cartesian(ylim = c(0.35, 0.75)) +
  theme_classic() + theme(legend.position = "bottom")

legend_grob <- ggpubr::get_legend(m_know_w_robust_s2_blind_plot_v2)

know_out_v2 <- ggpubr::ggarrange(m_know_w_robust_s2_blind_plot_v2, m_know_w_robust_s2_rev_plot_v2, ncol = 2, nrow = 1,
                  top = "Post-Reform Study Source Cue Effects and Political Knowledge", 
                  common.legend = FALSE, legend="bottom", legend.grob = legend_grob)

know_out_v2

ggpubr::ggexport(know_out_v2[1],filename = "polknow_plot_v2.png", width = 1600, height = 800, pointsize = 100, res = 200)
```


# Appendix E: Descriptive Stats

```{r summary_stats, echo=FALSE, message=FALSE, warning=FALSE}
dat2 <- dat2 %>%
  mutate(party = case_when(voted == 1 & party_voted %notin% c("forgot") ~ party_voted,
                      voted == 0 ~ party_supported))
dat <- dat %>%
  mutate(party = case_when(voted == 1 & party_voted %notin% c("forgot") ~ party_voted,
                      voted == 0 ~ party_supported))

summary_dat <- dat %>%
  filter(treatment %in% c("blind", "revealed")) %>%
  ungroup() %>%
  summarise(
    female = mean(female, na.rm = T),
    age = mean(age, na.rm = T),
    ba_grad = mean(ba_grad, na.rm = T),
    full_time = mean(employment == "Working full time"),
    part_time = mean(employment == "Working part time"),
    retired = mean(employment == "Retired"),
    voted = mean(voted),
    PiS = sum(party %in% "pis") / nrow(dat2),
    Dem_Opposition = sum(party %in% c("ko", "nl", "td"))  / nrow(dat2),
    Confederation = sum(party %in% "kon") / nrow(dat2),
    political_interest = mean(pol_interest_n),
    tvp_watcher = mean(use_tvp, na.rm =  T),
    tvn_watcher = mean(use_tvn, na.rm = T),
    pref_tv = mean(media_pref == "tv"),
    pref_online = mean(media_pref == "online"),
    pref_radio = mean(media_pref == "radio"),
    pref_print = mean(media_pref == "print"),
    pref_other = mean(media_pref == "other")
  )%>%
  t() %>%
  as_tibble() %>%
  rename("Study_1" = "V1")

summary_dat2 <- dat2 %>%
  ungroup() %>%
  summarise(
    female = mean(female, na.rm = T),
    age = mean(age, na.rm = T),
    ba_grad = mean(ba_grad, na.rm = T),
    full_time = mean(employment == "Working full time"),
    part_time = mean(employment == "Working part time"),
    retired = mean(employment == "Retired"),
    voted = mean(voted),
    PiS = sum(party %in% "pis") / nrow(dat2),
    Dem_Opposition = sum(party %in% c("ko", "nl", "td"))  / nrow(dat2),
    Confederation = sum(party %in% "kon") / nrow(dat2),
    political_interest = mean(pol_interest_n),
    tvp_watcher = mean(use_tvp, na.rm =  T),
    tvn_watcher = mean(use_tvn, na.rm = T),
    pref_tv = mean(media_pref == "tv"),
    pref_online = mean(media_pref == "online"),
    pref_radio = mean(media_pref == "radio"),
    pref_print = mean(media_pref == "print"),
    pref_other = mean(media_pref == "other")
  )%>%
  t() %>%
  as_tibble() %>%
  rename("Study_2" = "V1")


demovars <- c("Female", "Age",  "BA Graduate",
              "Employed Full Time", "Employed Part Time", "Retired",
              "Voted", 
              "PiS", "Democratic Opposition", "Confederation",
              "Political Interest", "TVP Watcher", "TVN Watcher", "TV News Prefered", "Online News Prefered", "Radio News Prefered", "Print News Prefered", "Other News Medium Prefered")

summary_dat <- tibble(demovars, summary_dat, summary_dat2)
```

```{r print_summary_stats, results='asis', echo=FALSE, message=FALSE, warning=FALSE}
print(xtable::xtable(summary_dat, caption = "Summary Statistics"), include.rownames = F, caption.placement = "top", comment = FALSE)

```



# Appendix F: Aditional Analyses
### Excerpt Platform: Facebook vs. Twitter

Here we assess whether adding in the articles posted to Twitter that weren't on Facebook in Post-Reform Study had a meaningful effect on results. 

```{r}
dat_long2 <- dat_long2 %>%
  mutate(excerpt_no = as.numeric(substr(excerpt, start = 4, stop = 6))) %>%
  mutate(fb = case_when((source == "tvr" & excerpt_no <= 56) ~ 1,
                        (source == "tvr" & excerpt_no > 56) ~ 0,
                        (source == "tvn" & excerpt_no >= 125 & excerpt_no <= 229) ~ 1,
                        (source == "tvn" & excerpt_no > 229) ~ 0,
                        (source == "tvp" & excerpt_no >= 100 & excerpt_no <= 132) ~ 1,
                        (source == "tvp" & excerpt_no > 132) ~ 0)) %>%
  dplyr::select(-excerpt_no)

dat_long2 %>% group_by(excerpt) %>% slice(1) %>% 
  group_by(source, fb) %>% summarize(n = n())  
```

```{r fit_cue_fb, message=FALSE}
#fit main models, OLS
 
#TVP effect on pro-pis respondents
m3_fb_p_tvp <- lm(trust_index ~ treated * fb, 
              data = dat_long2[dat_long2$pro_pis == 1 & 
                                dat_long2$source == "tvp",],
              weights = excerpt_prev_weight)
m3_fb_p_tvp_cl <- coeftest(m3_fb_p_tvp, vcov = vcovCL, cluster = ~ResponseId)

#TVN effect on anti-pis/ Democratic Opposition respondents

m3_fb_d_tvn <- lm(trust_index ~ treated * fb,
              data = dat_long2[dat_long2$anti_pis == 1 &
                                dat_long2$source == "tvn",],
              weights = excerpt_prev_weight)
m3_fb_d_tvn_cl <- coeftest(m3_fb_d_tvn, vcov = vcovCL, cluster = ~ResponseId)

#TVN cue effect on pro-pis

m3_fb_p_tvn <- lm(trust_index ~ treated * fb,
              data = dat_long2[dat_long2$pro_pis == 1 &
                                dat_long2$source == "tvn",],
              weights = excerpt_prev_weight)
m3_fb_p_tvn_cl <- coeftest(m3_fb_p_tvn, vcov = vcovCL, cluster = ~ResponseId)

#tvp effect on anti-pis

m3_fb_d_tvp <- lm(trust_index ~ treated * fb,
              data = dat_long2[dat_long2$anti_pis == 1 &
                                dat_long2$source == "tvp",],
              weights = excerpt_prev_weight)
m3_fb_d_tvp_cl <- coeftest(m3_fb_d_tvp, vcov = vcovCL, cluster = ~ResponseId)

```

```{r print_cue_fb_results, results='asis', message=FALSE, echo=FALSE}
m1 <- m3_fb_p_tvp
m2 <- m3_fb_p_tvn
m3 <- m3_fb_d_tvp
m4 <- m3_fb_d_tvn

m1_cl <- m3_fb_p_tvp_cl
m2_cl <- m3_fb_p_tvn_cl
m3_cl <- m3_fb_d_tvp_cl
m4_cl <- m3_fb_d_tvn_cl

additional_lines <- list(c("Excerpt FE", rep("No", 4)), c("Weights", rep("Yes", 4)))

stargazer::stargazer(m1, m2, m3, m4,
                     header = FALSE,
                     label = "tab:main3_fb", 
                     title = "Main Source Effect Results",
                     covariate.labels = c("SourceRevealed", "Facebook", "SourceRevealed x Facebook"),
                     dep.var.labels = c("Trust Index"),
                     column.labels = c("TVP|PiS", "TVN|PiS", "TVP|DO", "TVN|DO"),
                     se=list(m1_cl[,2], m2_cl[,2], m3_cl[,2], m4_cl[,2]),
                     omit.stat = c("f", "rsq", "ser"),
                     omit = c("excerpt", "Constant"),
                     add.lines = additional_lines, 
                     notes = "Trust index measured on 0 (low trust) to 1 (high trust)")
```


### Guessing

```{r}
guessing_dat <- read.csv("poland2_guessing_excerpt.csv")

clean_string <- function(x) {
  # Remove underscores
  no_underscore <- gsub("_", "", x)
  # Keep the first 6 characters
  substr(no_underscore, 1, 6)
}
guessing_dat$excerpt <- clean_string(guessing_dat$excerpt)

guessable <- guessing_dat$excerpt[which(guessing_dat$corr_perc > .4)]

mean(guessing_dat$corr_perc)

dat_long_all <- left_join(dat_long_all, guessing_dat[,4:9])


dat_long_all <- dat_long_all %>%
  mutate(aligned_source = case_when(
    party_bin == "PiS" & source == "tvp" & study == "Pre-Reform Study" ~ 1,
    party_bin == "PiS" & source == "tvn" ~ 0,
    party_bin == "PiS" & source == "tvr" ~ 1,
    party_bin == "DO" & source == "tvp" & study == "Pre-Reform Study" ~ 0,
    party_bin == "DO" & source == "tvn" ~ 1,
    party_bin == "DO" & source == "tvr" ~ 0,
  ))

m_guess_treated_aligned <- lm(trust_index ~ corr_perc*treated, data = dat_long_all[dat_long_all$aligned_source == 1])

m_guess_treated_counter <- lm(trust_index ~ corr_perc*treated, data = dat_long_all[dat_long_all$aligned_source == 0])

m_guess_treated_aligned_cl <- lm_robust(trust_index ~ corr_perc*treated, 
                                        data = dat_long_all[dat_long_all$aligned_source == 1],
                                        clusters = ResponseId)

m_guess_treated_counter_cl <- lm_robust(trust_index ~ corr_perc*treated, 
                                        data = dat_long_all[dat_long_all$aligned_source == 0],
                                        clusters = ResponseId)


m_guess_treated_aligned_cl <- lm_robust(trust_index ~ corr_perc*treated, 
                                        data = dat_long_all[dat_long_all$aligned_source == 1 & dat_long_all$source == "tvr",],
                                        clusters = ResponseId)

m_guess_treated_counter_cl <- lm_robust(trust_index ~ corr_perc*treated, 
                                        data = dat_long_all[dat_long_all$aligned_source == 0],
                                        clusters = ResponseId)

```


```{r print_guessability_models, results='asis', echo=FALSE}
m1 <- m_guess_treated_aligned
m2 <- m_guess_treated_counter

m1_cl <- m_guess_treated_aligned_cl
m2_cl <- m_guess_treated_counter_cl


additional_lines <- list(c("Weights", "No", "No"))
stargazer::stargazer(m1, m2,
                     header = FALSE,
                     label = "tab:guessability_models", 
                     title = "Treatment Effects and Guessability",
                     covariate.labels = c("Excerpt Guessability",  "SourceRevealed", "Excerpt Guessability*Revealed"),
                     dep.var.labels = c("Trust Index"),
                     column.labels = c("Aligned", "Counter"),
                     se=starprep(m1_cl, m2_cl, clusters = dat_long$ResponseId), 
                     omit.stat = c("f", "rsq", "ser"),
                     add.lines = additional_lines,
                     notes = "Excerpt guessability is percentage that correctly guessed source in separate question. TVP Post-Reform Study trials excluded.")
```


```{r fit_hg_mods, cache=TRUE}
dat_long_hg <- dat_long %>%
  filter(excerpt %notin% guessable)
dat_long2_hg <- dat_long2 %>%
  filter(excerpt %notin% guessable)

m_hg_p_s1 <- lm(trust_index ~ tvp*treated,
                data = dat_long_hg[dat_long_hg$pro_pis == 1,])
m_hg_p_s1_cl <- lm_robust(trust_index ~ tvp*treated,
                data = dat_long_hg[dat_long_hg$pro_pis == 1,],
                clusters = ResponseId)
m_hg_d_s1 <- lm(trust_index ~ tvp*treated,
                data = dat_long_hg[dat_long_hg$anti_pis == 1,])
m_hg_d_s1_cl <- lm_robust(trust_index ~ tvp*treated,
                data = dat_long_hg[dat_long_hg$anti_pis == 1,],
                clusters = ResponseId)

m_hg_p_s2 <- lm(trust_index ~ tvp + tvr + tvp*treated + tvr*treated,
                data = dat_long2_hg[dat_long2_hg$pro_pis == 1,])
m_hg_p_s2_cl <- lm_robust(trust_index ~ tvp + tvr + tvp*treated + tvr*treated,
                data = dat_long2_hg[dat_long2_hg$pro_pis == 1,],
                clusters = ResponseId)
m_hg_d_s2 <- lm(trust_index ~ tvp + tvr + tvp*treated + tvr*treated,
                data = dat_long2_hg[dat_long2_hg$anti_pis == 1,])
m_hg_d_s2_cl <- lm_robust(trust_index ~ tvp + tvr + tvp*treated + tvr*treated,
                data = dat_long2_hg[dat_long2_hg$anti_pis == 1,],
                clusters = ResponseId)


```


```{r print_hg_models_1, results='asis', echo=FALSE}
m1 <- m_hg_p_s1
m2 <- m_hg_d_s1
m3 <- m_hg_p_s2
m4 <- m_hg_d_s2

m1_cl <- m_hg_p_s1_cl
m2_cl <- m_hg_d_s1_cl
m3_cl <- m_hg_p_s2_cl
m4_cl <- m_hg_d_s2_cl

additional_lines <- list(c("Weights", "No", "No", "No", "No"))
stargazer::stargazer(m1, m2, m3, m4,
                     header = FALSE,
                     label = "tab:hg_models", 
                     title = "Source Preferences and Treatment Effects, Excluding Highly Guessable",
                     covariate.labels = c("TVP", "Republika", "SourceRevealed", "TVP*Revealed", "Republika*Revealed"),
                     dep.var.labels = c("Trust Index"),
                     column.labels = c("PiS Respondent", "Dem. Oppo. Respondent", "PiS Respondent", "Dem. Oppo. Respondent"),
                     se=starprep(m1_cl, m2_cl, m3_cl, m4_cl, clusters = dat_long$ResponseId), 
                     omit.stat = c("f", "rsq", "ser"),
                     add.lines = additional_lines,
                     notes = "Trust index measured on 0 (low trust) to 1 (high trust). Reference source is TVN.")
```


```{r}
prop.table(table(dat$saw_count[dat$treated == 0]))
prop.table(table(dat2$saw_count[dat2$treated == 0]))
prop.table(table(dat$saw_unknown[dat$treatment == "blind"], useNA = "always"))
prop.table(table(dat2$saw_unknown[dat$treatment == "blind"], useNA = "always"))

prop.table(table(dat$saw_count[dat$treatment == "blind" & dat$saw_none == 0 & dat$saw_unknown == 0], useNA = "always"))
prop.table(table(dat2$saw_count[dat2$treatment == "blind" & dat2$saw_none == 0 & dat2$saw_unknown == 0], useNA = "always"))


dat_tvp_blind <- dat %>%
  filter(treatment == "blind" & source == "tvp") %>%
  summarize(
    mainly_saw_tvp = mean(mainly_saw_tvp),
    mainly_saw_tvn = mean(mainly_saw_tvn),
    mainly_saw_republika = mean(mainly_saw_republika)
  )

dat_tvn_blind <- dat %>%
  filter(treatment == "blind" & source == "tvn")%>%
  summarize(
    mainly_saw_tvp = mean(mainly_saw_tvp),
    mainly_saw_tvn = mean(mainly_saw_tvn),
    mainly_saw_republika = mean(mainly_saw_republika)
  )

dat2_tvp_blind <- dat2 %>%
  filter(treatment == "blind" & source == "tvp")%>%
  summarize(
    mainly_saw_tvp = mean(mainly_saw_tvp),
    mainly_saw_tvn = mean(mainly_saw_tvn),
    mainly_saw_republika = mean(mainly_saw_republika)
  )

dat2_tvn_blind <- dat2  %>%
  filter(treatment == "blind" & source == "tvn")%>%
  summarize(
    mainly_saw_tvp = mean(mainly_saw_tvp),
    mainly_saw_tvn = mean(mainly_saw_tvn),
    mainly_saw_republika = mean(mainly_saw_republika)
  )

dat2_tvr_blind <- dat2  %>%
  filter(treatment == "blind" & source == "tvr")%>%
  summarize(
    mainly_saw_tvp = mean(mainly_saw_tvp),
    mainly_saw_tvn = mean(mainly_saw_tvn),
    mainly_saw_republika = mean(mainly_saw_republika)
  )

guess_summary <- round(bind_rows(dat_tvp_blind, dat_tvn_blind, dat2_tvp_blind, dat2_tvn_blind, dat2_tvr_blind), 2)

assigned_source <- c("TVP Pre-Reform Study", "TVN Pre-Reform Study", "TVP Post-Reform Study", "TVN Post-Reform Study", "TV Republika Post-Reform Study")

guess_summary <- data_frame(assigned_source, guess_summary) 

print(xtable::xtable(guess_summary), include.rownames = F)
```

## Voters Only

```{r}
table(dat$voted[dat$party_bin == 'PiS'])
prop.table(table(dat$voted[dat$party_bin == 'PiS']))

```


```{r}
table(dat$voted[dat$party_bin == 'DO'])
prop.table(table(dat$voted[dat$party_bin == 'DO']))

```


```{r}
table(dat2$voted[dat2$party_bin == 'PiS'])
prop.table(table(dat2$voted[dat2$party_bin == 'PiS']))

```
```{r}
table(dat2$voted[dat2$party_bin == 'DO'])
prop.table(table(dat2$voted[dat2$party_bin == 'DO']))

```




```{r}
#preference for TVP content blind, weighted by article frequency, pro-pis, study 1
m_btt_p_s1_w_votersonly <- lm(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$pro_pis == 1 & dat_long$voted == 1,],
                weights = excerpt_prev_weight)
m_btt_p_s1_w_cl_votersonly <- lm_robust(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$pro_pis == 1 & dat_long$voted == 1,],
                weights = excerpt_prev_weight,
                clusters = ResponseId)

#preference for TVP content blind, weighted by article frequency, anti-pis
m_btt_d_s1_w_votersonly <- lm(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$anti_pis == 1 & dat_long$voted == 1,],
                weights = excerpt_prev_weight)
m_btt_d_s1_w_cl_votersonly <- lm_robust(trust_index ~ tvp,
                data = dat_long[dat_long$treatment == "blind" &
                                  dat_long$anti_pis == 1 & dat_long$voted == 1,],
                weights = excerpt_prev_weight,
                clusters = ResponseId)
```


```{r}
#preference for TVP content blind, weighted by article frequency, pro-pis, study 1
m_btt_p_s2_w_cl_votersonly <- lm_robust(trust_index ~ tvp + tvr,
                data = dat_long2[dat_long2$treatment == "blind" &
                                  dat_long2$pro_pis == 1 & dat_long2$voted == 1,],
                clusters = ResponseId)

#preference for TVP content blind, weighted by article frequency, anti-pis
m_btt_d_s2_w_cl_votersonly <- lm_robust(trust_index ~ tvp + tvr,
                data = dat_long2[dat_long2$treatment == "blind" &
                                  dat_long2$anti_pis == 1 & dat_long2$voted == 1,],
                clusters = ResponseId)

```

```{r}
#VOTERS ONLY INTERACTED MODEL

m_d_tvp_t1v2_w_votersonly <- lm(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                 dat_long_all$source_f == "TVP" & dat_long_all$voted == 1,],
                              weights = excerpt_prev_weight) 
m_d_tvp_t1v2_w_cl_votersonly <- lm_robust(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                 dat_long_all$source_f == "TVP" & dat_long_all$voted == 1,],
                              weights = excerpt_prev_weight,
                              se_type = "stata",
                              clusters = ResponseId) 

m_p_tvp_t1v2_w_votersonly <- lm(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                    dat_long_all$source_f == "TVP" & dat_long_all$voted == 1,],
                              weights = excerpt_prev_weight) 
m_p_tvp_t1v2_w_cl_votersonly <- lm_robust(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                    dat_long_all$source_f == "TVP" & dat_long_all$voted == 1,],
                              weights = excerpt_prev_weight,
                              se_type = "stata",
                              clusters = ResponseId) 

m_d_tvn_t1v2_w_votersonly <- lm(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                    dat_long_all$source_f == "TVN" & dat_long_all$voted == 1,],
                              weights = excerpt_prev_weight) 
m_d_tvn_t1v2_w_cl_votersonly <- lm_robust(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$anti_pis == 1 &
                                                    dat_long_all$source_f == "TVN" & dat_long_all$voted == 1,],
                              weights = excerpt_prev_weight,
                              se_type = "stata",
                              clusters = ResponseId) 


m_p_tvn_t1v2_w_votersonly <- lm(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                    dat_long_all$source_f == "TVN" & dat_long_all$voted == 1,],
                              weights = excerpt_prev_weight) 
m_p_tvn_t1v2_w_cl_votersonly <- lm_robust(trust_index ~ treated * study_f_label,
                              data = dat_long_all[dat_long_all$pro_pis == 1 &
                                                    dat_long_all$source_f == "TVN" & dat_long_all$voted == 1,],
                              weights = excerpt_prev_weight,
                              se_type = "stata",
                              clusters = ResponseId) 
```


```{r}
m_d_tvp_t1v2_w_cl
```
```{r results ='asis'}
##PRODUCE STARGAZER PLOT SHOWING THE RESULTS FOR VOTERS ONLY
m1 <- m_p_tvp_t1v2_w_votersonly
m2 <- m_p_tvn_t1v2_w_votersonly
m3 <- m_d_tvp_t1v2_w_votersonly
m4 <- m_d_tvn_t1v2_w_votersonly

m1_cl <- m_p_tvp_t1v2_w_cl_votersonly
m2_cl <- m_p_tvn_t1v2_w_cl_votersonly
m3_cl <- m_d_tvp_t1v2_w_cl_votersonly
m4_cl <- m_d_tvn_t1v2_w_cl_votersonly
  
additional_lines <- list(c("Weights", rep("Yes", 4)))

stargazer(m1, m2, m3, m4,
          header = FALSE,
          label = "tab:t1v2_votersonly",
          title = "Source Cue Effects and Experiment Timing: Voters Only",
          covariate.labels = c("SourceRevealed", "Post-Reform", "SourceRevealed*Post-Reform"),
          dep.var.labels = c("Trust Index"),
          column.labels = c("TVP|PiS", "TVN|PiS", "TVP|DO", "TVN|DO"),
          se=starprep(m1_cl, m2_cl, m3_cl, m4_cl),
          omit.stat = c("f", "rsq", "ser"),
          omit = c("excerpt", "Constant"),
          add.lines = additional_lines, 
          notes = "Trust index measured on 0 (low trust) to 1 (high trust)")
```





